package com.zlp.controller;
import java.util.Date;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.zlp.entity.User;
import org.apache.http.client.methods.HttpPost;

/**
 * @Classname Test
 * @Description TODO
 * @Date 2022/11/29 21:56
 * @Created by ZouLiPing
 */
public class Test {

    public static <T> T post(String param,TypeReference<T> typeReference) {

        return JSON.parseObject(param, typeReference);
    }

    public static void main(String[] args) {
        User user = new User();
        user.setId(0L);
        user.setUsername("FDSF");
        user.setPassword("FSDF");
        user.setNickname("FSDFDS");
        user.setUserType(0);
        user.setStatus(0);
        user.setCreateTime(new Date());
        user.setCreateUser("");
        user.setUpdateTime(new Date());
        user.setUpdateUser("");
        User responseDTO = post(JSON.toJSONString(user) ,new TypeReference<User>() {
        });
        System.out.println(JSON.toJSONString(responseDTO));


    }
}
